import { createApp, Directive } from 'vue';
import App from './App.vue';
import router from '@/router';
import { setupStore } from '@/store';
import { customMain } from './framework/main'; // plugins
import ElementPlus from 'element-plus';

import Pagination from '@/framework/components/Pagination/index.vue';
import '@/permission';

// 引入svg注册脚本
import 'virtual:svg-icons-register';

// 国际化
import i18n from '@/framework/lang/index';
// import DQBasicVueComponent from 'DQBasic-vue3-component';
import '@/framework/styles/index.scss';
import 'element-plus/theme-chalk/index.css';
//import 'element-plus/theme-chalk/dark/css-vars.css';

const app = createApp(App);
customMain(app); //
// 自定义指令
import * as directive from '@/directive';
Object.keys(directive).forEach(key => {
  app.directive(key, (directive as { [key: string]: Directive })[key]);
});
// 全局方法
import { getDictionaries } from '@/framework/api/dict';
app.config.globalProperties.$getDictionaries = getDictionaries;

// 全局挂载
setupStore(app);
app
  .component('Pagination', Pagination)
  .use(router)
  .use(ElementPlus)
  .use(i18n)
  // .use(DQBasicVueComponent)
  .mount('#app');
